package org.luu.medicare.controller.reimburseController;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.luu.medicare.common.Result;
import org.luu.medicare.entity.PageBean;
import org.luu.medicare.entity.Person;
import org.luu.medicare.entity.TPersonnelVisitsInfo;
import org.luu.medicare.entity.TPrescriptionDetail;
import org.luu.medicare.service.PersonService;
import org.luu.medicare.service.PersonnelVisitService;
import org.luu.medicare.service.PrescriptionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequiredArgsConstructor(onConstructor_ = {@Autowired})
@RequestMapping("/center")
@Slf4j
public class CenterReimController {
    private final PrescriptionService prescriptionService;
    private final PersonnelVisitService personnelVisitService;
    private final PersonService personService;

    @GetMapping
    public Result<PageBean<Person>> page(@RequestParam(defaultValue = "1") int page,
                                         @RequestParam(defaultValue = "10") int pageSize,
                                         String name,
                                         String id){
        return personService.page(page, pageSize, name, id);
    }

    @PostMapping("/visit")
    public Result<String> save(@RequestBody TPersonnelVisitsInfo tPersonnelVisitsInfo){
        return personnelVisitService.save(tPersonnelVisitsInfo);
    }

    @PostMapping("/pres")
    public Result<String> save(@RequestBody TPrescriptionDetail tPrescriptionDetail){
        return prescriptionService.save(tPrescriptionDetail);
    }
}
